<@t.header> </@t.header> <@t.body>
	<div class="navbar navbar-default navbar-fixed-top padding-0 margin-0">
		<div class="navbar-header">
			<a class="navbar-brand" href="#" style="border-right: 1px solid #ddd;">
				<i class="icon-flag" style="color:#11e;"></i>
				色度检测
			</a>
		</div>
		<ul class="nav navbar-nav suredy-form-bar" id="btList">
			<a class="navbar-brand" href="#" id="btn-ok">
				<i class="icon-ok"></i> 完成
			</a>			
			<a class="navbar-brand" href="#" id="btn-save">
				<i class="icon-save"></i> 保存
			</a>		
		</ul>
		<ul class="nav navbar-nav navbar-right">
			<li>
				<a href="#" class="suredy-close-form">
					<i class="icon-remove close" style="margin-right: 10px;"></i>
				</a>
			</li>
		</ul>
	</div>
	<div class="container suredy-form" style="margin-top:50px;">
		<div class="panel-body" style="border:1px solid #ddd;">
			<div class="row">
				<div class="text-center col-md-12 col-xs-12">
					<h2>色度检测原始记录</h2>
				</div>
			</div>
			<br />
			<#if colorimetry??>
				<form name="form" id="form">	
					<input type="hidden" name="id" id="id" value="${colorimetry.id}" />
					<input type="hidden" name="ctrlInfo" id="ctrlInfo">
					<input type="hidden" name="ESID" id="ESID" value="${Session['flow_session'].sessionId}">
					<input type="hidden" name="processId" id="processId" value="${colorimetry.processId}">
					<input type="hidden" name="createTime" id="createTime" value="${colorimetry.createTime}">
					<input type="hidden" name="fileType" id="fileType" value="test">
					<input type="hidden" name="fileTypeCode" id="fileTypeCode" value="${colorimetry.fileTypeCode}">
					<input type="hidden" name="creatorCode" id="creatorCode" value="${colorimetry.creatorCode}">
					<input type="hidden" name="creatorUnitCode" id="creatorUnitCode" value="${colorimetry.creatorUnitCode}">
					<input type="hidden" name="title" id="title" value="色度检测"/>
					<table class="table">
						<tr>
							<td width="10%" class="text-right" style="border:0px; line-height:100%; vertical-align: middle;">采样日期</td>
							<td width="40%" style="border:0px;"><input type="text" class="form-control datetimepicker" id="sampleDate" name="sampleDate" data-time="${colorimetry.sampleDate}" data-format="yyyy-MM-dd"/></td>
							<td width="10%" class="text-right" style="border:0px; line-height:100%; vertical-align: middle;">检测日期</td>
							<td width="40%" style="border:0px;"><input type="text" class="form-control datetimepicker" id="detectionDate" name="detectionDate" data-time="${.now}" data-format="yyyy-MM-dd"/></td>
						</tr>
						<tr>
							<td class="text-right" style="border:0px; line-height:100%; vertical-align: middle;">室内温度℃</td>
							<td style="border:0px;"><input type="text" class="form-control" id="temerature" name="temerature" placeholder="室内温度" value="${(colorimetry.temerature)!''}" /></td>
							<td class="text-right" style="border:0px; line-height:100%; vertical-align: middle;">室内湿度%</td>
							<td style="border:0px;"><input type="text" class="form-control" id="humidity" name="humidity" placeholder="室内湿度" value="${(colorimetry.humidity)!''}"/></td>
						</tr>
					</table>
					
					<table class="table table-bordered">
						<tr>
							<td width="10%" class="text-center" style="line-height:100%; vertical-align: middle;">检测方法</td>
							<td colspan="3"><input type="text" class="form-control" id="method" name="method" value="${(colorimetry.method)!'铂-钴标准比色法'}" /></td>
							<td colspan="2" class="text-center" style="line-height:100%; vertical-align: middle;">方法依据</td>
							<td colspan="4"><input type="text" class="form-control" id="standards" name="standards" value="${(colorimetry.method)!'GB/T5750.4-2006中的1.1'}" /></td>
						</tr>
						<tr>
							<td colspan="3" class="text-center" style="line-height:100%; vertical-align: middle;">标准溶液名称浓度</td>
							<td colspan="4"><input type="text" class="form-control" id="standardSolution" name="standardSolution" value="${(colorimetry.standardSolution)!'铂-钴标准溶液'} (${(colorimetry.standardConcentration)!'500'}度)" /></td>
							<td width="10%" class="text-center" style="line-height:100%; vertical-align: middle;">样品体积(ml)</td>
							<td  colspan="2" ><input type="text" class="form-control" id="sampleVolume" name="sampleVolume" placeholder="样品体积" value="${(colorimetry.sampleVolume)!''}" /></td>
						</tr>
						<tr>
							<td rowspan="2" class="text-center" style="line-height:100%; vertical-align: middle;">标准溶液</td>
							<td width="10%" class="text-center">用量(ml)</td>
							<td width="10%" class="text-center">&nbsp;</td>
							<td width="10%" class="text-center">&nbsp;</td>
							<td width="10%" class="text-center">&nbsp;</td>
							<td width="10%" class="text-center">&nbsp;</td>
							<td width="10%" class="text-center">&nbsp;</td>
							<td width="10%" class="text-center">&nbsp;</td>
							<td width="10%" class="text-center">&nbsp;</td>
							<td width="10%" class="text-center">&nbsp;</td>
						</tr>
						<tr>
							<td width="10%" class="text-center">色度(度)</td>
							<td width="10%" class="text-center">&nbsp;</td>
							<td width="10%" class="text-center">&nbsp;</td>
							<td width="10%" class="text-center">&nbsp;</td>
							<td width="10%" class="text-center">&nbsp;</td>
							<td width="10%" class="text-center">&nbsp;</td>
							<td width="10%" class="text-center">&nbsp;</td>
							<td width="10%" class="text-center">&nbsp;</td>
							<td width="10%" class="text-center">&nbsp;</td>							
						</tr>	
						<tr>
							<td width="10%" class="text-center" style="line-height:100%; vertical-align: middle;">计算公式</td>
							<td colspan="4"><input type="text" class="form-control" id="formula" name="formula" value="${(colorimetry.formula)!'色度(度)=M/N*500'}" /></td>
							<td colspan="5"><input type="text" class="form-control" id="formulaDescription" name="formulaDescription" value="${(colorimetry.formulaDescription)!'M-相当于铂-钴标准溶液用量(ml);V-水样体积(ml)'}" /></td>
						</tr>	
						<tr>
							<td class="text-right" style="line-height:100%; vertical-align: middle;">备注</td>
							<td colspan="9"><textarea rows="3" class="form-control" type="text" name="comments" placeholder="备注">${(colorimetry.comments)!''}</textarea></td>
						</tr>																
					</table>
						
					<table width="100%" id="items-list" class="table table-striped table-bordered table-hover">
						<tr class="title-row">
							<th width="30%">样品编号</th>
							<th width="30%">用量(ml)</th>
							<th width="30%">检测结果(度)</th>
							<th width="10%" class="text-center">操作</th>
						</tr>
						<#if colorimetry.items ??><#list colorimetry.items as item>
							<tr>
								<td><input type="hidden" name="item_id" value="${item.id}" /><input type="text" class="form-control" name="sampleId" value="${item.sampleId}" /></td>
								<td><input type="text" class="form-control" name="consumption" ${(1==item.deprecated)?string('readonly=\"readonly\"','')} value="${item.consumption}" /></td>
								<td><input type="text" class="form-control" name="detectionValue" ${(1==item.deprecated)?string('readonly=\"readonly\"','')}  value="${item.detectionValue}" /><input type="hidden" name="deprecated" value="${item.deprecated!'0'}" /></td>
								<td>
									<div class="btn btn-info redoItem"> 
										<i class="icon-undo"></i> 重做此项
									</div>
								</td>
							</tr>
						</#list></#if>																							
					</table>
											
					<table width="100%" class="table">
						<tr>
							<td width="10%" class="text-right" style="border:0px; line-height:100%; vertical-align: middle;">检测人</td>
							<td width="40%" style="border:0px;">
								<input type="text" readonly="readonly" class="form-control" id="detectorName" name="detectorName" value="${Session['login_user'].name}" />
								<input type="hidden" id="detector" name="detector" value="${Session['login_user'].id}" />
							</td>
							<td width="10%" class="text-right" style="border:0px; line-height:100%; vertical-align: middle;">审核人</td>
							<td width="40%" style="border:0px;"><input type="text" class="form-control" readonly="readonly" id="auditorName" name="auditorName"  /></td>
						</tr>
						<tr>
							<td colspan="4" class="text-right" style="border:0px; line-height:100%; vertical-align: middle;">昆明清源自来水有限责任公司水质</td>
						</tr>
						<tr>
							<td colspan="4" class="text-right" style="border:0px; line-height:100%; vertical-align: middle;">表单编号:KMQY06D-JL-T-004</td>
						</tr>						
					</table>		
				</form>
			</#if>
			<div class="col-md-12 col-xs-12" id="comment-content"></div>															
		</div>	
		
	</div>
</@t.body> <@t.foot>
	
	<script src="${request.contextPath}/core/js/flow-core.js"></script>
	<script src="${request.contextPath}/core/js/jquery.form.js"></script>
	<script src="${request.contextPath}/js/suredy-datetimepicker.js"></script>
	<script src="${request.contextPath}/js/flow-app.js"></script>
	<script src="${request.contextPath}/js/suredy-modal.js"></script>
	
	<script src="${request.contextPath}/component/flow/js/sender.js"></script>
	<script src="${request.contextPath}/component/flow/js/comment.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {	
			initForm();
			$.suredy.datetimepicker.init();		
			
			$('#referenceSolution-edit').click(function() {
				$.suredy.showModal({
					size : 'lg',
					icon : 'icon-edit',
					title : '标准溶液用量-色度参考值',
					showFoot : false,
					uri : $.suredy.contextPath + '/app/detection/standards-reference.html'
				});			
			});					
			
						
			$('.redoItem').click(function() {
				var source = $(this).parent().parent();
				var tr = source.clone();
				tr.children('td').eq(0).children('input').eq(0).val('');
				tr.children('td').eq(2).children('input').eq(1).val('0');
				source.children('td').eq(1).children('input').eq(0).attr('readonly', 'readonly');
				source.children('td').eq(2).children('input').eq(0).attr('readonly', 'readonly');
				source.children('td').eq(2).children('input').eq(1).val('1');
				tr.children('td').eq(3).html('');
				tr.insertAfter('#items-list tr:eq('+ source.index() +')');
			});
			
			$('#btn-save').click(function() {
			/*
				$('#items-list tr:not(:first)').each(function(){
					var index = $(this).index() - 1;
					$(this).children('td').each(function(){
						$(this).children('input').each(function(){
							var name = $(this).attr('name');
							$(this).attr('name', 'items[' + index + '].' + name);
						});
					});
	            });			
			*/	
				
				$('#form').ajaxSubmit({
					url : $.suredy.contextPath + '/app/detection/colorimetry-edit',
					dataType : 'json',
					type : 'POST',
					success : function(success) {
						if (!success) {
							alert('保存色度检测任务失败！');
						} else if (!success.success) {
							alert('保存色度检测任务失败！\n\n' + success.msg);
						} else {
							alert('保存色度检测任务成功！');
						}
					},
					error : function(a, b, c) {
						alert('服务器错误! ' + c);
					}
				});				
				

							
			});
		});


			
	
		
		function saveForm() {	
	
		}
	</script>	
</@t.foot>
